package com.xinzhi.controller;


import com.xinzhi.pojo.dto.DtoBumen;
import com.xinzhi.pojo.dto.Dtoaddbumen;
import com.xinzhi.service.BumenService;
import com.xinzhi.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class BumenController {
    @Autowired
    private BumenService bumenService;

    /**
     * 部门台账全部查询接口
     * @return
     */
    @GetMapping("/selectbumenAll")
    public Result selectbumenAll() {
        return bumenService.selectbumenAll();
    }


    /**
     * 部门台账页面新增接口
     * @param dtoBumen
     * @return
     */
    @PostMapping("/addbumentianxie")
    public Result addbumentianxie(@RequestBody Dtoaddbumen dtoBumen) {
        return bumenService.addbumen(dtoBumen);
    }

    /**
     * 部门台账页面修改接口
     * @param dtoBumen
     * @return
     */
    @PostMapping("/updatebumen")
    public Result updatebumen(@RequestBody Dtoaddbumen dtoBumen) {
       return bumenService.updatebumen(dtoBumen);
    }

    /**
     * 部门台账页面逻辑删除接口
     * @param id
     * @return
     */
    @GetMapping("/updatedeleted")
    public Result updatedeleted(Integer id ) {
        return bumenService.deletebumen(id );
    }

    /**
     * 部门台账页面根据年份查询接口
     * @param yearnumber
     * @return
     */
    @GetMapping("/selectbumentianxie")
    public Result selectbumentianxie(String yearnumber) {
        return bumenService.selectbumen(yearnumber);

    }

}
